<template>
  <div>
    <Timeline
      class="ivu-pt-16"
      style="height: calc( 100vh - 420px); overflow: auto;"
      v-if="data.length > 0"
    >
      <TimelineItem v-for="(item, index) in data" :key="index">
        <p class="time">{{ item.created_at_str }}</p>
        <p class="content">{{ item.action_content }}</p>
        <p class="consultant">
          <span>{{ item.profession_name }}</span>
          <span class="c-inr">{{ item.operate_name }}</span>
          <Badge status="processing" :text="item.action_type_str"></Badge>
        </p>
      </TimelineItem>
    </Timeline>
    <div
      v-else
      style="
                width: 100%;
                height: calc( 100vh - 420px);
                display: flex;
                align-items: center;
                justify-content: center;
            "
    >
      <span>暂无数据</span>
    </div>
    <Spin size="large" fix v-if="showSpin" />
  </div>
</template>
<script>
import { patientindexpatientoperatelist } from "@/api/hqapi";
export default {
  name: "Journal",
  data() {
    return {
      showSpin: false,
      params: { patient_user_id: "", page: 0, pageSize: 0 },
      data: [],
    };
  },
  methods: {
    askData(id) {
      this.data = [];
      this.params.patient_user_id = id;
      this.askDatas();
    },
    askDatas() {
      this.showSpin = true;
      patientindexpatientoperatelist(this.params).then((res) => {
        this.data = res.list;
        this.showSpin = false;
      });
    },
  },
};
</script>
<style scoped>
.time {
  font-size: 14px;
  font-weight: bold;
}
.content {
  padding: 10px 0;
}
.consultant {
  color: #9ea7b4;
}
.c-inr {
  margin: 0 10px;
}
</style>
